docker run --name freeswitch -d --net host -v /etc/freeswitch/ /etc/freeswitch/ fs:1.10     #-v 本地目录挂载到docker
#docker run --name freeswitch -d --net host -p 5060:5060/tcp -p 5060:5060/udp fs:1.10   #nat
#docker run --name fs -p 5060:5060/tcp -p 5060:5060/udp -p 5080:5080/tcp -p 5080:5080/udp -p 8021:8021/tcp -p 7443:7443/tcp -p 20000-24999:20000-24999/udp -p 60535-65535:60535-65535/udp fs:1.10

#CID=$(docker run --name freeswitch -p 5060:5060/tcp -p 5060:5060/udp -p 5080:5080/tcp -p 5080:5080/udp -p 8021:8021/tcp -p 7443:7443/tcp -p20000-24999:20000-24999/udp -p 60535-65535:60535-65535/udp -v /etc/freeswitch /etc/freeswitch fs:1.10)

# 手动添加iptables规则
#CIP=$(sudo docker inspect --format='{{.NetworkSettings.IPAddress}}' $CID)

#iptables -A DOCKER -t nat -p udp -m udp ! -i docker0 --dport 20000:24999 -j DNAT --to-destination $CIP:20000-24999
#iptables -A DOCKER -p udp -m udp -d $CIP/32 ! -i docker0 -o docker0 --dport 20000:24999 -j ACCEPT
#iptables -A POSTROUTING -t nat -p udp -m udp -s $CIP/32 -d $CIP/32 --dport 20000:24999 -j MASQUERADE

#iptables -A DOCKER -t nat -p udp -m udp ! -i docker0 --dport 60535:65535 -j DNAT --to-destination $CIP:60535-65535
#iptables -A DOCKER -p udp -m udp -d $CIP/32 ! -i docker0 -o docker0 --dport 60535:65535 -j ACCEPT
#iptables -A POSTROUTING -t nat -p udp -m udp -s $CIP/32 -d $CIP/32 --dport 60535:65535 -j MASQUERADE

docker exec -it freeswitch /bin/bash
